/*
 * @Descripttion: 
 * @version: 
 * @Author: ChenXiang
 * @Date: 2021-09-08 20:08:16
 * @LastEditors: ChenXiang
 * @LastEditTime: 2021-09-30 10:30:45
 */
import type from '@/common/utils/type';
import React, { useEffect, useState } from 'react';
import { dataItemProps } from './buttonGroup'


interface ItemProps extends dataItemProps {
  active?: boolean;
}

export interface ButtonProps {
  data: ItemProps,
  value?: string | string[],
  onClick: (isActive: boolean, data: ItemProps, index: number) => void,
  index: number,
  isActive: any
}
const Item: React.FC<ButtonProps> = (props) => {
  const { isActive } = props;
  const { text, value, } = props.data;
  return (
    <div className="item-wrap"
      data-active={isActive}
      onClick={() => {
        props.onClick(isActive, { text, value }, props.index)
      }}
    >
      <div className="item">
        {text}
      </div>
    </div>
  )
};

export default Item;
